package com.qj.platform.pay.core.service;

import com.qj.base.commons.domain.SearchObject;
import com.qj.platform.pay.core.dao.AgentDao;
import com.qj.platform.pay.core.domain.Agent;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by zhijie on 2016/12/14.
 */
@Service
public class AgentService {
    @Autowired
    private AgentDao agentDao;

    public Agent getById(String id) {
        return agentDao.getById(id);
    }

    public String insert(Agent agent) {
        String id = agentDao.insert(agent);
//        Merchant merchantResponse=MSSMPayService.getMSSMPayPlatformInstance().addMerchant(agent);
//        agentDao.updateMerchantCode(id,merchantResponse.getMerchantCode());
        return id;
    }

    public void update(Agent agent) {
        agentDao.update(agent);
//        MSSMPayService.getMSSMPayPlatformInstance().updateMerchant(agent);
    }

    public List<Agent> query(SearchObject searchObject) {
        return agentDao.search(searchObject);
    }

    public int queryCount(SearchObject searchObject) {
        return agentDao.searchCount(searchObject);
    }
}
